﻿{extend name="base"/}
{block name="main"}
<div class="Hui-article">
    <article class="cl pd-20">
        <div id="tab_demo" class="HuiTab" style="margin-top: 0px; position: relative;">
            <div class="tabBar clearfix">
                <span class="current"  >物流公司列表</span>
                <div class="l n_tab_add"><a href="{:url('express/express_add')}"><i
                        class="Hui-iconfont">&#xe600;</i> 添加模版</a></div>
            </div>
        </div>
  <div class="cl pd-5 bg-1 bk-gray mt-20">
        <form class="Huiform" method="post" action="__CONF_SITE__admin/express/express_list" target="_self" style=" padding: 15px;">
            <div class="text-c"> 公司名称：
               <input type="text" class="input-text" value="{$search_text}" style="width:250px" placeholder="输入公司名称"  name="search_text">
                <button type="submit" class="btn btn-search radius"  name=""><i class="Hui-iconfont">&#xe665;</i> 搜物流</button>
            </div>
        </form>
</div>
        <table class="table table-border table-bordered table-hover table-bg">
            <thead>
            <tr>
                <th scope="col" colspan="9">物流公司列表</th>
            </tr>
            <tr class="text-c">
                <th>公司Logo</th>
                <th>公司名称</th>
                <th>物流编号</th>
                <th>联系电话</th>
                <th>是否默认</th>
                <th>是否启用</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="retval" id="vo"}
            <tr class="text-c">
                <td>
                    <img src="{$vo['express_logo']}" class="radius" width="50px">
                </td>
                <td>{$vo['company_name']}</td>
                <td>{$vo['express_no']}</td>
                <td>{$vo['phone']|default="无"}</td>
                <td>
                    {if $vo['is_default']==1}
                    <span class="label label-primary radius">默认</span>
                    {else}
                    <span class="label label-default radius">否</span>
                    {/if}
                </td>
                <td>
                    {if $vo['is_enabled']==1}
                    <span class="label label-success radius">已启用</span>
                    {else}
                    <span class="label label-danger radius">已禁用</span>
                    {/if}
                </td>
                <td>
                    <a title="编辑" href="javascript:;" onclick="express_edit('编辑物流公司','__CONF_SITE__admin/express/express_edit&co_id={$vo.co_id}','1000','800')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                    <!--<a title="设置运费模版" href="__CONF_SITE__admin/express/freightTemplateList&co_id={$vo.co_id}" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe72d;</i></a>-->
                    <a title="删除" href="javascript:;" onclick="express_del(this,'{$vo.co_id}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
    </article>
    <div class="n_page_no">
        {$page}
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    function fee_add(title, url, w, h) {
        layer.open({
            type: 2,
            area: [w, h],
            fix: false, //不固定
            maxmin: true,
            shade: 0.4,
            title: title,
            content: url
        });
    }
	/*
	 参数解释：
	 title	标题
	 url		请求的url
	 id		需要操作的数据id
	 w		弹出层宽度（缺省调默认值）
	 h		弹出层高度（缺省调默认值）
	 */
	/*物流-设置运费模版*/
    function express_fee(title,url,w,h){
        layer.open({
            type: 2,
            area: [w, h],
            fix: false, //不固定
            maxmin: true,
            shade:0.4,
            title: title,
            content: url
        });
    }
    /*物流-编辑*/
    function express_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }
	/*物流-删除*/
    function express_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //此处请求后台程序
            //后台处理
            $.ajax({
                type : "post",
                url : "{:url('express/expressDelete')}",
                data : {
                    "co_id" : id,
                },
                success : function(data) {
                    if (data['code'] > 0) {
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }else{
                        layer.msg(data['message'], {icon: 2, time: 1000});
                    }
                }
            })
        });
    }
</script>
{/block}